package cn.tedu.mall.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import redis.clients.jedis.Jedis;

@Configuration
@PropertySource("classpath:/propertites/redis.propertites")
public class RedisConfig {
    @Value("${redis.host}")
    private String node;
    @Bean
    public Jedis jedis(){
        String[] nodeArray = node.split(":");
        String host = nodeArray[0];
        int port = Integer.parseInt(nodeArray[1]);
        return new Jedis(host,port);
    }

}
